home *** CD-ROM | disk | FTP | other *** search
/ Leonardo the Inventor / Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso / LEOWINMV / SHARED.DIR / 03091_Script_COPY SCREEN < prev    next >
Text File  |  1996-04-01  |  7KB  |  203 lines

  1. -- --------------------------------------------------------------------------------------
  2. -- Handler setUpCopyXobj opens the xobject that will be used for copying throughout the
  3. -- program. It is opened once at the beginning of the programe and closed once at the end
  4. -- because if the object is disposed of, pasting into other applications does not work.
  5.  
  6. on setUpCopyXobj
  7.   global copyObj
  8.   
  9.   if (the machineType = 256) then
  10.     openXObjHandler "STAGETC.DLL"
  11.     -- create a new object
  12.     set copyObj = stageTC(mNew, 0, 0, the stageBottom - the stageTop, the stageRight-the stageLeft)
  13.   else
  14.     openXObjHandler "StageToCast XObj"
  15.     -- create a new object
  16.     set copyObj = stageToCast(mNew, 0, 0, the stageBottom - the stageTop, the stageRight-the stageLeft)
  17.   end if
  18. end
  19.  
  20. --mNew  -- creates the object in RAM,
  21. --             and is used to specify the region
  22. --             of the screen. Four integers are in 
  23. --             order of: Top, Left, Bottom, Right.
  24. --             Example of Lingo syntax:
  25.  
  26. -- --------------------------------------------------------------------------------------
  27. -- Handler endCopyXobj disposes of the instance of the xobject and closes the xobject
  28. -- that will be used for copying throughout the program. It is opened once at the
  29. -- beginning of the programe and closed once at the end because if the object is
  30. -- disposed of, pasting into other applications does not work.
  31.  
  32. on endCopyXobj
  33.   global copyObj
  34.   
  35.   if objectP(copyObj) then
  36.     copyObj(mdispose)
  37.   end if
  38.   
  39.   if (the machineType = 256) then
  40.     closeXObjHandler "STAGETC.DLL"
  41.   else
  42.     closeXObjHandler "StageToCast XObj"
  43.   end if
  44. end
  45.  
  46. -- --------------------------------------------------------------------------------------
  47. -- Handler doClickCopyButton hilites the copy button and copies the screen.
  48.  
  49. on doClickCopyButton copyType, source
  50.   puppetTransition 0
  51.   sound stop 1
  52.   
  53.   hiliteButton(1,0)
  54.   doCopy(copyType, source)
  55.   
  56.   allowPastingMAC
  57.   dontPassEvent
  58. end
  59.  
  60. -- --------------------------------------------------------------------------------------
  61. -- Handler doCopy calls the appropriate copy handler to copy
  62. -- the current screen
  63.  
  64. on doCopy copyType, source
  65.   if (copyType = "dataBase") then
  66.     copyDatabase
  67.   else if (copyType = "timeLine") then
  68.     copyTimeline
  69.   else if (copyType = "cast") then
  70.     copyCast(source)
  71.   else if (copyType = "file") then
  72.     copyFile(source)
  73.   end if
  74. end
  75.  
  76. -- --------------------------------------------------------------------------------------
  77. -- Handler copyTimeline ???
  78.  
  79. on copyTimeline
  80.   copyToClipBoard cast "TimeLineTextForCopying"
  81. end
  82.  
  83. -- --------------------------------------------------------------------------------------
  84. -- Handler copyDatabase copies the picture or text of the currently selected database
  85. -- topic.
  86.  
  87. on copyDatabase
  88.   global copyObj, textButton, pictureButton
  89.   
  90.   -- call the copy function to copy
  91.   if isActivated(textButton) then
  92.     copyDatabaseText
  93.   else if isActivated(pictureButton) then
  94.     copyDatabasePicture
  95.   end if
  96. end
  97.  
  98. -- ----------------------------------------------------------------
  99. -- Handler copyDataBaseText does the actual copying of the text
  100. -- of the selected topic in the database to the clipboard.
  101.  
  102. on copyDatabaseText
  103.   global textSprite, numPagesInClickedTopic, clickedTopic, copyTextCast
  104.   
  105.   put EMPTY into cast copyTextCast
  106.   
  107.   if (the editableText of sprite textSprite = TRUE) then
  108.     set copyText = the selection
  109.     set the editableText of sprite textSprite = FALSE
  110.     put copyText into cast copyTextCast
  111.   else
  112.     put clickedTopic & RETURN into field copyTextCast -- Article Title
  113.     repeat with curPage = 1 to numPagesInClickedTopic
  114.       put the text of cast (clickedTopic && "TEXT" & curPage) & RETURN after cast copyTextCast
  115.     end repeat
  116.     put RETURN & "⌐1996 SoftKey Multimedia Inc., a subsidiary of SoftKey International Inc." after cast copyTextCast
  117.   end if
  118.   copyToClipBoard cast copyTextCast
  119. end
  120.  
  121. -- ----------------------------------------------------------------
  122. -- Handler copyDataBasePicture does the actual copying of the
  123. -- picture of the selected topic in the database to the clipboard.
  124.  
  125. on copyDatabasePicture
  126.   global pictureSprite, clickedTopic
  127.   
  128.   copyToClipBoard cast the castNum of sprite pictureSprite
  129. end
  130.  
  131. -- --------------------------------------------------------------------------------------
  132. -- Handler copyCast copies the given cast to the clipBoard
  133.  
  134. on copyCast whichCast
  135.   copyToClipBoard cast whichCast
  136. end
  137.  
  138. -- --------------------------------------------------------------------------------------
  139. -- Handler copyFile imports the given file to a cast and then copies the cast
  140. -- to the clipBoard
  141.  
  142. on copyFile whichFile
  143.   global copyPictureCast
  144.   
  145.   if (the machineType = 256) then
  146.     set divider = "\"
  147.   else
  148.     set divider = ":"
  149.   end if
  150.   
  151.   set fullFileName = the pathName & "PrtPicts" & divider & whichFile
  152.   
  153.   importFileInto cast copyPictureCast, fullFileName
  154.   copyToClipBoard cast copyPictureCast
  155. end 
  156.  
  157. -- --------------------------------------------------------------------------------------
  158. -- Handler allowPastingMAC allows the user to paste what was copied by going to the finder
  159. -- after a copy was done.
  160.  
  161. on allowPastingMAC
  162.   if (the machineType = 256) then exit
  163.   
  164.   global dialogSprite, pasteNowRect, cancelPasteRect
  165.   global pasteDialogLocH, pasteDialogLocV
  166.   
  167.   set the castNum of sprite dialogSprite = the number of cast "copy Dialog"
  168.   set the locH of sprite dialogSprite = pasteDialogLocH
  169.   set the locV of sprite dialogSprite = pasteDialogLocV
  170.   updateStage
  171.   
  172.   choosePasteOption
  173. end
  174.  
  175. -- --------------------------------------------------------------------------------------
  176. -- Handler choosePasteOption is the cast script of the copy dialog box. it allows the 
  177. -- user to choose a paste option and works well with the interruptanimation handler
  178.  
  179. on choosePasteOption
  180.   repeat while not (the mousedown)
  181.     updatestage
  182.   end repeat
  183.   
  184.   global dialogSprite, pasteNowRect, cancelPasteRect
  185.   
  186.   -- find out where clicked
  187.   set clickPoint = point(the mouseH, the mouseV)
  188.   
  189.   if (inside(clickPoint, pasteNowRect)) then
  190.     -- don't use removeFromStage because this updates
  191.     -- stage which causes the calling of the script of the
  192.     -- sprite under the paste dialog box.
  193.     set the locV of sprite dialogSprite = 1000
  194.     open "finder"
  195.     abort
  196.   else
  197.     -- don't use removeFromStage because this updates
  198.     -- stage which causes the calling of the script of the
  199.     -- sprite under the paste dialog box.
  200.     set the locV of sprite dialogSprite = 1000)
  201.     abort
  202.   end if
  203. end